import Vue from 'vue'
import App from './App.vue'
import router from './router'

Vue.config.productionTip = false

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
import {Message} from"element-ui";

router.beforeEach((to,from,next)=>{
  if (to.path=='/'){
    next();
  }else{
    let user = window.sessionStorage.getItem('loginer');
    console.log(user);
    if (user == null){
      Message.warning({message:'请先登录'})
      next('/');
    }else{
      next();
    }
  }
})

new Vue({
  router,

  render: h => h(App)
}).$mount('#app')
